package com.ruoyi.common.utils;

import javax.servlet.http.HttpServletRequest;

/**
 * @author fangzhuan
 * @date 2022年08月30日 16:29
 */
public class TokenUtils {
    /**
     * 获取 request 里传递的 token
     *
     * @param request
     * @return
     */
    public static String getTokenByRequest(HttpServletRequest request) {
        String token = request.getParameter("token");
        if (StringUtils.isEmpty(token)) {
            token = request.getHeader("Authorization");
            if(StringUtils.isEmpty(token)){
                token = request.getHeader("Token");
            }
        }
        return token;
    }
}
